package com.example.freemarker.template;

import com.example.annotations.Autowired;
import com.example.annotations.Compontent;
import com.example.flowable.model.FlowableModel;
import com.example.flowable.model.FormModel;
import com.example.flowable.model.TableModel;
import com.example.flowable.service.FlowableModelService;
import com.example.flowable.service.FormModelService;
import com.example.flowable.service.TableModelService;
import com.example.freemarker.config.DirectiveHandler;
import com.example.freemarker.config.FreemarkerCompontent;
import com.example.freemarker.config.TemplateDirective;

import java.util.Map;

/**
 * @Classname ProcessDataModelTemplate
 * @Description TODO
 * @Date 2022/9/4 14:51
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@FreemarkerCompontent("ProcessDataModel")
@Compontent
public class ProcessDataModelTemplate extends TemplateDirective {


    @Autowired
    private FlowableModelService flowableModelService;

    @Autowired
    private TableModelService tableModelService;

    @Override
    public String getName() {
        return "ProcessDataModel";
    }

    @Override
    public void execute(DirectiveHandler handler) throws Exception {
        //流程id
        String id=handler.getString("id");
        //主键id
        String dataId=handler.getString("dataId");
        FlowableModel flowableModel=flowableModelService.getById(id);
        Integer fromId=flowableModel.getFromId();
        //获取表的模型
        TableModel tableModel=tableModelService.getById(fromId);
    }
}
